package org.deltaset.meta.internal.mockmeta;

import org.deltaset.meta.EntityResolver;
import org.deltaset.meta.extension.RepositoryProvider;

/**
 *
 * @author dmakariev
 */
public class RepositoryProviderImpl implements RepositoryProvider{



    @Override
    public Class defaultRepositoryClass() {
        return ModelRepository.class;
    }

    @Override
    public Object locateRepository(final Class serviceClass, final Class entityClass) {
        // final ApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
//        try {
//
//            final Object service = getBeanFactory().getBean(serviceClass);
//            return service;
//        } catch (NoSuchBeanDefinitionException ex) {
//        } catch (BeansException ex) {
//        }
        final BaseRepository baseRepository = new BaseRepository();//getBeanFactory().getBean(BaseRepository.class);
        return new BaseModelRepository(baseRepository, entityClass);
    }

    @Override
    public EntityResolver createEntityResolver() {
        return new EntityResolverImpl();
    }
}
